<?php
class ORMPayment extends ORMBase {
  public function __construct() {
    parent::__construct('Payment');
  }

  public function __toEpObject($myManager, $epObject, $object) {
    $epObject->trackId = isset($object->trackId) ? $object->trackId : '';
    $epObject->cancelled = isset($object->cancelled) ? $object->cancelled : 0;
    $epObject->createdDate = (isset($object->createdDate) && $object->createdDate) ? SimpleDate::toStamp($object->createdDate) : 0;
    $epObject->date = (isset($object->date) && $object->date) ? SimpleDate::toStamp($object->date) : 0;
    $epObject->amount = isset($object->amount) ? $object->amount : 0;
    $epObject->method = isset($object->method) ? $object->method : '';
    $epObject->stage = isset($object->stage) ? $object->stage : 0;
    $epObject->userAccount = isset($object->userAccount) ? $object->userAccount : '';
    $epObject->orderFlag = isset($object->orderFlag) ? $object->orderFlag : '';
    $epObject->orderTrackId = isset($object->orderTrackId) ? $object->orderTrackId : '';
    $epObject->orderId = isset($object->orderId) ? $object->orderId : 0;
    $epObject->customerId = isset($object->customerId) ? $object->customerId : 0;
    $epObject->status = isset($object->status) ? $object->status : 0;
    $epObject->isPdSolved = isset($object->isPdSolved) ? $object->isPdSolved : 0;
    $epObject->pdSolvedNote = isset($object->pdSolvedNote) ? $object->pdSolvedNote : '';
    $epObject->cancelledDate = (isset($object->cancelledDate) && $object->cancelledDate) ? SimpleDate::toStamp($object->cancelledDate) : 0;
    $epObject->cancelledOperator = isset($object->cancelledOperator) ? $object->cancelledOperator : '';
    $epObject->cancelledMessage = isset($object->cancelledMessage) ? $object->cancelledMessage : '';
    $epObject->pdAdmAppr = isset($object->pdAdmAppr) ? $object->pdAdmAppr : 0;
    return $epObject;
  }

  public function __toObject($myManager, $epObject, $object) {
    $object->id = $epObject->oid;
    $object->trackId = $epObject->trackId;
    $object->cancelled = $epObject->cancelled;
    $object->createdDate = ($epObject->createdDate != 0) ? SimpleDate::fromStamp($epObject->createdDate) : 0;
    $object->date = ($epObject->date != 0) ? SimpleDate::fromStamp($epObject->date) : 0;
    $object->amount = $epObject->amount;
    $object->method = $epObject->method;
    $object->stage = $epObject->stage;
    $object->userAccount = $epObject->userAccount;
    $object->orderFlag = $epObject->orderFlag;
    $object->orderTrackId = $epObject->orderTrackId;
    $object->orderId = $epObject->orderId;
    $object->customerId = $epObject->customerId;
    $object->status = $epObject->status;
    $object->isPdSolved = $epObject->isPdSolved;
    $object->pdSolvedNote = $epObject->pdSolvedNote;
    $object->cancelledDate = ($epObject->cancelledDate != 0) ? SimpleDate::fromStamp($epObject->cancelledDate) : 0;
    $object->cancelledOperator = $epObject->cancelledOperator;
    $object->cancelledMessage = $epObject->cancelledMessage;
    $object->pdAdmAppr = $epObject->pdAdmAppr;
    return $object;
  }
}
?>
